<?php
declare(strict_types=1);
 

namespace App\Game\Mapper;

use App\Game\Model\GameVip;
use Hyperf\Database\Model\Builder;
use Mine\Abstracts\AbstractMapper;

/**
 * vip等级Mapper类
 */
class GameVipMapper extends AbstractMapper
{
    /**
     * @var GameVip
     */
    public $model;

    public function assignModel()
    {
        $this->model = GameVip::class;
    }

    /**
     * 搜索处理器
     * @param Builder $query
     * @param array $params
     * @return Builder
     */
    public function handleSearch(Builder $query, array $params): Builder
    {
        // 等级
        if (isset($params['level']) && filled($params['level'])) {
            $query->where('level', '=', $params['level']);
        }

        return $query;
    }
}